import apiClient from '@/api/apiClient.ts';
import { CarRealTimeLocation, CompanyCar } from '#/entity.ts';

export enum RealTimeMonitoringApi {
  'GetCompanyCarTree' = '/roadCure/realTimeMonitor/getCompanyCarTree',
  'GetCarRealTimeLocation' = '/roadCure/realTimeMonitor/getCarRealTimeLocation',
}

interface GetCompanyCarTreeParams {
  carStatus?: number;
}

const getCompanyCarTree = (data: GetCompanyCarTreeParams) =>
  apiClient.post<CompanyCar[]>({
    url: RealTimeMonitoringApi.GetCompanyCarTree,
    data,
  });

const getCarRealTimeLocation = (params: { carNo: string }) =>
  apiClient.get<CarRealTimeLocation>({
    url: RealTimeMonitoringApi.GetCarRealTimeLocation,
    params,
  });

export default {
  getCompanyCarTree,
  getCarRealTimeLocation,
};
